<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AddArticleRequest extends FormRequest
{
    /**
     * 验证开启
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 表单验证 --- 规则 --
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required',
            'desn'  => 'required',
            'body'  => 'required',
            'pic'   => 'required'
        ];
    }

    /**
     * 自定义错误信息
     * @return array|string[]
     */
    public function messages()
    {
        return [
            'title.required' => '标题必须填写',
        ];
    }
}
